<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>
<%@ include file="/WEB-INF/public/head.jsp" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=0">
    <meta http-equiv="pragma" content="no-cache"/>
    <meta http-equiv="cache-control" content="no-cache"/>
    <meta name="apple-mobile-web-app-capable" content="yes"/>
    <meta name="apple-touch-fullscreen" content="yes"/>
    <meta name="apple-mobile-web-app-status-bar-style" content="black"/>
    <meta name="format-detection" content="telephone=no"/>
    <title>会员钱包</title>
    <link rel="stylesheet" href="${system}/static/css/shan2.css">
    <link href="${system}/static/css/home.css" rel="stylesheet" type="text/css" media="all"/>
    <link href="${system}/static/css/feedback.css" rel="stylesheet" type="text/css"/>
    <link href="${system}/static/css/mui_alert.css" rel="stylesheet" type="text/css">
</head>
<body>
<div class="main" width="100%" id="main">


    <div class="ma">
        <ul>
            <li>利率</li>
            <li>${interestRate}%</li>
            <li>
                <button style="background-color:red; height:40px; width:80px; color:white; border:none; border-radius:5px;">
                    还钱
                </button>
            </li>
        </ul>
        <ul>
            <li>总额度</li>
            <li id="money">${quota}</li>
            <li>
                <button id="borrow_money"
                        style="background-color:red; height:40px; width:80px; color:white; border:none; border-radius:5px;">
                    借钱
                </button>
                <!--<button style="background-color:#fff; height:40px; width:80px; border-style:solid; border-color:red; border-width:0.5px; color:black;">还钱</button>-->
            </li>
        </ul>
        <div class="clear"></div>
    </div>


    <div class="zi" style="font-size:17px">
        可用额度(元)
        <div style="margin-top:10px; font-size:50px">${quota}<%--${empty balance ? quota : balance}--%></div>
    </div>
    <div class="clear"></div>
</div>
<script src="${system}/static/js/mui.min.js"></script>
<script src="${system}/static/js/mui.js"></script>
</body>
<script type="text/javascript">


    $(function () {
        $('.main').height($(window).height());
    });

    $("#borrow_money").click(function () {

        //用户是否存在借款记录
        ajax("${system}/quota/loanExist", "", "text", "post", true, function (data) {
            switch (data) {
                case "exist":
                    window.location.href="${system}/order/loanOrder";
                    break;
                case "not_exist":
                    //用户额度是否足够借款
                    ajax("${system}/loan/available", "", "text", "post", true, function (data) {
                        switch (data) {
                            case "limit":
                                mui.alert("无额度可供使用", "提示", "OK");
                                break;
                            case "not_limit":
                                window.location.href = "${system}/loan/bystages";
                                break;
                        }
                    }, function (error) {
                        Error(error);
                    });
                    break;
            }
        }, function (error) {
            Error(error);
        });
    });

    function Error(error) {
        console.log(error);
        mui.alert("出现问题,请稍后再试", "提示", "OK");
    }
</script>
</html>